package org.liu.simpleTank;

import java.util.EventObject;

public class RobotAI extends Tank.TankListener {
	int count;{ count = 0; }
	@Override
	public void blocked(EventObject e) {
		while(count++ > 20) { // approximately 0.33 second
			Tank t = (Tank) e.getSource();
			// set new random direction when blocked
			t.getStatus().setDir((int) (Math.random() * 4));
			count = 0;
		}
	}
}
